import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import store from "../store";

Vue.use(VueRouter)


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

router.afterEach((route) => {
  const current = route.matched[route.matched.length - 1].components.default;
  console.log("当前current",current);
  const title = current.name || "课程管理";

  store.dispatch("changeBreadCrumbs", [{ text: title }]);
});

export default router
